// @ts-nocheck
import React from "react";
import { StyleSheet, View } from "react-native";
import Dialog from "react-native-dialog";
import translate from "utils/translate";

export default (props) => {
  return (
    <View style={styles.container}>
      <Dialog.Container visible={props.visible}>
        <Dialog.Title style={{ textAlign: "center" }}>
          {props.title ?? translate("main.tip")}
        </Dialog.Title>
        <Dialog.Description>{props.content}</Dialog.Description>
        {props.children}
        {(props.needCancel ?? true) && (
          <Dialog.Button
            label={translate("main.Cancel")}
            onPress={props.handleCancel}
          />
        )}
        <Dialog.Button
          label={translate("main.Submit")}
          onPress={props.handleSubmit}
        />
      </Dialog.Container>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});
